<template>
    <div id="needMarket">
        <baseinfo></baseinfo>
        <div class="title">
            <i class="el-icon-star-on"></i>
            <span>需求市集</span>
            <i class="el-icon-star-on"></i>
        </div>
        <div id="showneed">
        <need 
          v-for="item in needs" 
          :key="item.index"
          :image="item.image"
          :username="item.username"
          :needTime="item.needTime"
          :description="item.description"
        ></need>
      </div>
    </div>
</template>

<script>
import need from '../components/need.vue'
import baseinfo from '../components/baseinfo.vue'
import {request} from '../network/request.js'

export default {
    components: {
        need, baseinfo
    },
    data(){
        return {
            needs:''
        }
    },
    created() {
        request({
            url: '/needMarket',
            method: 'get',
        }).then(res => {
            this.needs = res.data.needs
        })
    }
}
</script>

<style scoped>

.title {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    padding-top: 25px;
    padding-bottom: 20px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    width: 200px;
}

.title i {
    padding: 5px;
}

</style>